package com.rem.designPattern.bridge桥接;

/**
 * 实现部分
 *
 * @author Rem
 * @date 2022-11-17
 */
public abstract class Shape {

    protected Color color;

    public abstract void drow(String name);

    public Shape(Color color) {
        this.color = color;
    }

    public Color getColor() {
        return color;
    }

    public void setColor(Color color) {
        this.color = color;
    }
}

class Circle extends Shape {

    public Circle(Color color) {
        super(color);
        System.out.println("圆形");
    }

    @Override
    public void drow(String name) {
        color.paintColor(name);
    }
}

class Rectangle extends Shape {
    public Rectangle(Color color) {
        super(color);
        System.out.println("长方形");
    }

    @Override
    public void drow(String name) {
        color.paintColor(name);
    }
}

class Square extends Shape {
    public Square(Color color) {
        super(color);
        System.out.println("正方形");
    }

    @Override
    public void drow(String name) {
        color.paintColor(name);
    }
}